<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="fragment::head(title='归档')">

</head>
<body>


<!--导航-->
<nav class="ui inverted attached segment" th:replace="~{fragment::nav(n=4)}">

</nav>


<!--中间内容-->
<div class="ui container m-padded-tb-massive">
    <div class="ui container" th:id="blog-block">
        <th:block th:fragment="blogs">
            <div class="ui segment top attached">
                <div class="ui two column grid">
                    <div class="column">
                        <h3>归档</h3>
                    </div>

                    <div class="column right aligned">
                        共<h3 class="ui header orange m-inline-block" th:text="${totalCount}"></h3>个归档
                    </div>
                </div>
            </div>
            <th:block th:if="${jsonResult!=null}">
                <div class="ui segment teal attached" th:each="tm , tmStat: ${jsonResult.data.data}">
                    <h3 class="ui header center aligned" th:text="${tm}"></h3>
                    <div class="ui fluid vertical menu" th:each=" blog:${lists.get(tmStat.index)}">
                        <a th:href="@{/user/toBlog/{bid}(bid=${blog.id})}" class="item">
                            <span>
                                <i class="ui icon circle mini red"></i>
                                <span th:text="${blog.title}"></span>
                            </span>
                            <label  class="ui orange basic left pointing label" th:text="${blog.shareStatement}? '原创':'转载'"></label>
                        </a>
                    </div>
                </div>
                <!--footer-->
                <div class="ui segment bottom attached">
                    <div class="ui two column grid">
                        <div class="column left aligned">
                            <button class="ui teal button" th:attr="data-curr=${jsonResult.data.prePage}" onclick="pageH(this)">上一页</button>
                        </div>
                        <div class="column right aligned">
                            <button class="ui teal button" th:attr="data-curr=${jsonResult.data.nextPage}" onclick="pageH(this)">下一页</button>
                        </div>
                    </div>
                </div>
            </th:block>

        </th:block>

    </div>

</div>


<!--底部的内容-->

<footer class="ui inverted vertical segment" th:replace="~{fragment::footer}">
</footer>

<th:block th:replace="~{fragment :: script}">
</th:block>

<script type="text/javascript">

    $(function () {
        $.ajax({
            url:"/user/listBlogByTime",
            type:"get",
            success:function (res) {
                $('#blog-block').html(res);
            }
        })
    })

    //分页函数
    function pageH(curr) {
        var currpage=$(curr).data("curr");
        $.ajax({
            url:"/user/listBlogByTime",
            type: "get",
            data:{
                "currentPage":currpage,
            },
            success:function (res) {
                $('#blog-content').html(res);
            }
        })
    }




    $('#pay-btn').popup({
        popup:$('#pay'),
        on:'click',
        position:'bottom center',
    })
</script>
</body>
</html>